package nc.ui.arap.actions.verify;

import java.util.Vector;

import nc.vo.arap.verifynew.DisplayVO;
import nc.vo.verifynew.pub.VerifyLogVO;

/**
 * nc.ui.arap.actions.verify.VerifyDeleteAction
 *
 * @author twei
 *
 */
public class VerifyDeleteAction extends VerifyBaseAction {

	public void execute() {
		
		Vector<VerifyLogVO> selectedLogs=new Vector<VerifyLogVO>();
    	
        for(int i=0;i<getCache().length;i++)
        {
        	if(getCache()[i]==null)
	    		continue;
        	
        	if(getCache()[i].getM_selected().booleanValue())
        	{
        		
        		int clid = getCache()[i].getM_clid().intValue();
	        	
	        	for(int t=0;t<getCom().getM_logs().size();t++)
				{
					if(((VerifyLogVO)getCom().getM_logs().get(t)).getM_pph().intValue()==clid)
					{
						selectedLogs.add((VerifyLogVO)getCom().getM_logs().get(t));
					}
				}
	        	
        		getCache()[i]=null;
        	}
        }

		getCom().getM_logs().removeAll(selectedLogs);
		selectedLogs.clear();
		Vector<DisplayVO> selected = new Vector<DisplayVO>();
		for (int i = 0; i < getCache().length; i++) {
			if (getCache()[i] != null) {
				selected.add(getCache()[i]);
			}
		}
		
		getDetailPanel().setCache(new DisplayVO[selected.size()]);
		selected.copyInto(getCache());
		getDetailPanel().setDisplayVO(getCache());
	}

}
